/****************************************************************************
**
** Copyright (C) 2013 Ernesto Barragan <ernestus at gmail dot com>
** Based on code by the Qt project:
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
**
** GNU General Public License Usage
** This file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtCore/QtGlobal>

#include <QMainWindow>
#include <QLabel>
#include <QSettings>
#include <QtSerialPort/QSerialPort>

#include "numericinputdialog.h"

QT_BEGIN_NAMESPACE

namespace Ui {
class MainWindow;
}

QT_END_NAMESPACE

class Console;
class SerialSettingsDialog;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void openSerialPort();
    void closeSerialPort();
    void about();
    void writeData(const QByteArray &data);
    void readSerialData();

    void handleError(QSerialPort::SerialPortError error);

    void on_actionFont_triggered();

    void on_actionInputInteger_triggered();

    void on_actionHexMode_triggered(bool checked);

    void on_action_Create_Byte_Sequence_triggered();

private:
    void initActionsConnections();

private:
    Ui::MainWindow *ui;
    Console *m_console;
    SerialSettingsDialog *m_settingsDialog;
    QSerialPort *m_serialPort;
    QLabel *m_serialPortTextIndicator ;
    QLabel* m_serialPortGraphicIndicator ;
    NumericInputDialog* m_numericInputDialog ;
    QSettings settings ;
};

#endif // MAINWINDOW_H
